<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Git上的免费的编程书籍</title>
  <link id="bts-style-link" rel="stylesheet" href="assets/lib/bootswatch/paper/bootstrap.min.css">
  <link id="code-style-link" rel="stylesheet" href="assets/lib/highlight/styles/github.css">
  <style>
    #book-list .book:hover {
      box-shadow: 0 0 10px #999;
    }
    #book-list .book-title {
      font-size: 18px;
      overflow: hidden;
      white-space: nowrap;
      -o-text-overflow: ellipsis;
      text-overflow:  ellipsis;
    }
    #book-list p.book-description {
      height: 6rem;
      line-height: 2em;
      overflow: hidden;
      /*white-space: nowrap; -o-text-overflow: ellipsis; text-overflow:  ellipsis;*/
    }
  </style>
  <script src="/books.js"></script>
</head>
<body>
  <nav class="navbar navbar-default">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-4" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="/">GIT Books</a>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-4">
        <p class="navbar-text">Some books from any git repo</p>
      </div>
    </div>
  </nav>
  <div class="container">
    <div class="jumbotron">
      <h1>Hello, Books!</h1>
      <p>free programming books ...</p>
      <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
    </div>
    <!-- <div class="page-header">
      <h1>Books<small>free programming books</small></h1>
    </div> -->

    <div id="book-list" class="row">
    </div>
  </div>

  <div class="page-footer" style="margin: 25px 0;">
    <div class="container">
      <div class="row">
        <div class="col-xs-12">
          <div class="info-box">
            <div class="info-item">
              Project <a href="https://github.com/git-books/git-books.github.io" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> Git-books</a>
            </div>
            <div class="info-item">
              Document site powered by <a href="https://github.com/inhere/md-site-reader" target="_blank"><i class="fa fa-github" aria-hidden="true"></i> inhere/md-site-reader</a>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- end.page-footer -->
<div class="panel panel-default">
  <div class="panel-body">
    Basic panel example
  </div>
</div>
  <script src="/assets/lib/jquery-2.2.4.min.js"></script>
  <script type="text/javascript">
    $(function () {
      let booksHtml = ''

      $.each(books, function (index, book) {
        // console.log(index, book)
        booksHtml += `
        <div class="book panel panel-default col-xs-6 col-sm-4 col-md-3">
          <div class="panel-body">
            <h4 class="book-title">
              <a href="${book.url}" title="${book.name}">${book.name}</a>
            </h4>
            <p class="book-description">${book.description} ...</p>
            <div class="clearfix">
              <a href="${book.url}" class="btn btn-primary btn-sm pull-right">
              Read <i class="glyphicon glyphicon-book" aria-hidden="true"></i>
              </a>
            </div>
          </div>
        </div>`
      })

      if (booksHtml) {
        $('#book-list').html(booksHtml)
      }
    })
  </script>
</body>
</html>
